Data Manipulation and Visualization with R

Lennart Kasserra

CorrelAid

2024-04-22

Welcome

Welcome to the follow-up to the “Intro to R”! If you see this you have managed to download the files from GitHub, which already makes you smarter than tolly500:

Setup time

If you haven’t already:

  1. Install R:
  • Windows
  • MacOS (make sure you select the right one based on whether you have an “old” intel mac or a new Apple silicon (M1/M2) mac)
  • Linux: from package manager (probably either R or r-base)
  1. Install RStudio from the official website

  2. Install packages:

  • once you are inside RStudio, head to the console (the little window that says “console”), enter install.packages(c("tidyverse", "gapminder", "here", "markdown", "rmarkdown")) and hit Enter.
  • Enjoy epic hacker moment
  1. Make yourself feel at home: If you’re done early, under Tools > Global Options > Appearance you can change the theme etc

Course outline

  • Day 1: Data Manipulation
    • Intro to the tidyverse (dplyr-verbs etc.)
    • Joining & data wrangling
    • Basic modelling & presentation of results
  • Day 2: Data Visualization
    • ggplot2
    • Bonus: maps with sf, interactive visualization with plotly, animations with gganimate.

Tidyverse

“The tidyverse is an opinionated collection of R packages designed for data science. All packages share an underlying design philosophy, grammar, and data structures.”

You can install all packages that belong to the tidyverse with:

install.packages("tidyverse")

Tidyverse vs. base R

In this course we teach the tidyverse because…

  • tidyverse-esque code usually more readable
  • Easier to pick up on for beginners
  • Coherent
  • Often faster than base R